package com.example.administrator.hqq.activity.register;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.MotionEvent;

import com.blankj.utilcode.util.SPUtils;
import com.example.administrator.hqq.R;
import com.example.administrator.hqq.activity.LogInActivity;
import com.example.administrator.hqq.base.MyActivity;
import com.example.administrator.hqq.config.LoongsConfig;
import com.example.administrator.hqq.config.UrlFactory;
import com.zhy.http.okhttp.OkHttpUtils;
import com.zhy.http.okhttp.callback.StringCallback;

import okhttp3.Call;

/**
 * @author 康海涛
 * @describe: 引导页
 */
public class GuideActivity extends MyActivity {
    private Context context=this;
    float x1 = 0;
    float x2 = 0;
    float y1 = 0;
    float y2 = 0;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_guide);
        SPUtils.getInstance().put(LoongsConfig.guide,true);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
//继承了Activity的onTouchEvent方法，直接监听点击事件
        if(event.getAction() == MotionEvent.ACTION_DOWN) {
//当手指按下的时候
            x1 = event.getX();
            y1 = event.getY();
        }
        if(event.getAction() == MotionEvent.ACTION_UP) {
//当手指离开的时候
            x2 = event.getX();
            y2 = event.getY();
            if(y1 - y2 > 50) {
                Intent intent=new Intent(this,LogInActivity.class);
                startActivity(intent);
                this.overridePendingTransition(R.anim.login_access,R.anim.guide_get_out);
                finish();
            } else if(y2 - y1 > 50) {

            } else if(x1 - x2 > 50) {

            } else if(x2 - x1 > 50) {

            }
        }
        return super.onTouchEvent(event);
    }

    @Override
    protected String getActivityName() {
        return this.getClass().getSimpleName();
    }
}
